//-
//- Copyright (c) Microsoft. All rights reserved.
//- Licensed under the MIT license. See LICENSE file in the project root for full license information.
//-

extends layout

block content
  div.container
    if enableMultipleAccounts === true
      h2 Select your account
    else
      h2 GitHub cleanup
      p.lead You need to unlink #{numberToRemove == 1 ? 'a' : numberToRemove} GitHub account#{numberToRemove == 1 ? '' : 's'}
      p.
        Please remove the accounts that you are not using for
        corporate work at this time. Removed accounts
        will lose access to any private repositories.
    div.row
      each column in linksForCleanupByColumn
        div.col-sm-6.col-md-6.col-lg-6
          each link in column
            div.horizontal-pad.vertical-space(style='border:4px solid #ddd')
              div
                h2= link.ghu
                p GitHub Account
                a.btn.btn-sm.btn-muted(href='https://github.com/' + link.ghu, target='_new')
                  | View #{link.ghu} GitHub Profile
                if enableMultipleAccounts === true
                  form(method='post').vertical-space
                    input(type='hidden', name='select', value=link.ghid)
                    input.btn-primary.btn-lg(class=buttonClass, type='submit', value=`Select ${link.ghu}`)
                form(method='post').vertical-space
                  input(type='hidden', name='unlink', value=link.ghid)
                  - var isConfirming = confirming === link.ghid
                  - var buttonClass = isConfirming ? 'btn-danger' : 'btn-default'
                  if isConfirming
                    input(type='hidden', name='confirm', value=link.ghid)
                    p.text-danger Please confirm that you are ready to unlink this GitHub account. It will lose access to any and all corporate organizations, teams and private repos.
                  input.btn.btn-lg(class=buttonClass, type='submit', value=isConfirming ? `Yes, unlink ${link.ghu}` : `Unlink ${link.ghu}`)
                if link.joinedDate
                  h5
                    | Linked&nbsp;
                    time(datetime=link.joinedDate.toISOString())= link.joinedDate.toDateString()

    if config && config.brand && config.brand.supportMail
      p.vertical-space
        | If you have any questions, please ping&nbsp;
        a.btn.btn-sm.btn-muted(href='mailto:' + config.brand.supportMail)= config.brand.supportMail
